Skip to content

Add example: Smart Turn detection - #92

Open
santhosh-005 wants to merge 1 commit into
livekit-examples:mainfrom
santhosh-005:add-smart-turn-detection-example
Open

Add example: Smart Turn detection#92
santhosh-005 wants to merge 1 commit into
livekit-examples:mainfrom
santhosh-005:add-smart-turn-detection-example

Conversation

@santhosh-005

Copy link
Copy Markdown

Adds docs/examples/smart_turn_detection/ — using an open end-of-turn model as
the turn detector in an AgentSession.

turn_handling["turn_detection"] accepts any object implementing the streaming
turn-detector protocol, but there is no example of supplying one. This shows the
shape:

proc.userdata["turn_detector"] = SmartTurnDetector(
    model="smart-turn-v3",
    on_prediction=log_prediction,
)
turn_handling={
    "turn_detection": ctx.proc.userdata["turn_detector"],
    "endpointing": {"min_delay": 0.3, "max_delay": 2.5},
}

on_prediction prints each decision, so the model is visible without a
frontend:

end of turn 1.2%  -> incomplete (threshold 0.50, 55 ms)
end of turn 94.5% -> complete   (threshold 0.50, 58 ms)

STT, LLM and TTS are the same inference.* models as
docs/examples/metrics_vad/, and VAD is the same Silero plugin. The one new
dependency is smart-turn-livekit, which loads the ONNX graph and adapts it to
the protocol — a few MB at int8, CPU-only, fetched from Hugging Face on first
use.

Default weights are upstream Smart Turn v3.
model= selects a different graph and model_path= loads your own.

Plugin: https://github.com/santhosh-005/smart-turn-livekit (BSD-2-Clause)

Verified on livekit-agents 1.7.0: frontmatter parses with
docs/tools/generate_index.py, the session builds with the detector attached,
and real speech through the detector returns predictions in 55–123 ms on one CPU
thread. Not tested with a live call.

@vercel

vercel Bot commented Aug 27, 2026

Copy link
Copy Markdown

@santhosh-005 is attempting to deploy a commit to the LiveKit Team on Vercel.

A member of the Team first needs to authorize it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant